<?php
/* @var $this StatusController */
/* @var $model Status */

$this->breadcrumbs=array(
	Yii::t('base','Statuses')=>array('index'),
	Yii::t('base','Manage'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#status-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<h1><?php echo Yii::t('base','Manage Statuses')?></h1>

<?php echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>');?>

<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'status-grid',
	'dataProvider'=>$model->search($last_called_date_and_time),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination',
	'cssFile'=>false,
	'template'=>'{items}{summary}{pager}',
	'columns'=>array(
	    //array('name'=>'status_id','headerHtmlOptions'=>array('style'=>'width:7%')),
		array('name'=>'customer_id','headerHtmlOptions'=>array('style'=>'width:10%'),'value'=>'PotentialCustomers::model()->getCustomersFirstLastName($data->customer_id)'),
		//array('name'=>'campaign_id','headerHtmlOptions'=>array('style'=>'width:14%'),'value'=>'Campaign::model()->getCampaignName($data->campaign_id)'),
		array('name'=>'agent_id','headerHtmlOptions'=>array('style'=>'width:14%'),'value'=>'User::model()->getUserName($data->agent_id)'),
		array('name'=>'status','headerHtmlOptions'=>array('style'=>'width:25%'),'value'=>'Status::model()->getStatusName($data->status)."|".$data->notes'),
		array('name'=>'follow_up','headerHtmlOptions'=>array('style'=>'width:15%')),
		array('name'=>'last_called_date_and_time','headerHtmlOptions'=>array('style'=>'width:15%')),
		/*
		'notes',
		'follow_up',
		'sign_up_date',
		'contract_expire_date',
		'package',
		*/
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'viewButtonImageUrl'=>array('class'=>'gicon-edit'),
			'viewButtonOptions'=>array('class'=>'btn btn-small'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			//'updateButtonOptions'=>array('style'=>'display:none'),//隐藏update按钮
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
				//'template'=>'{view}{delete}{viewdetailCallHistory}',
				'template'=>'{update}{viewdetailCallHistory}{callFollowUpPhone}{delete}',
				'buttons'=>array(
				'viewdetailCallHistory'=>array(
				'label'=>Yii::t('base','viewdetailCallHistory'),
				'url'=>'Yii::app()->createUrl("status/viewdetailCallHistory",array("customer_id"=>$data->customer_id,"campaign_id"=>$data->campaign_id))',
				
				'options'=>array('class'=>'btn btn-small','target'=>'_blank'),
				),
				
				'callFollowUpPhone'=>array(
				'label'=>Yii::t('base','callFollowUpPhone'),
				'url'=>'Yii::app()->createUrl("status/callFollowUpPhone",array("status_id"=>$data->status_id))',
				
				'options'=>array('class'=>'btn btn-small','target'=>'_blank'),
				'visible'=>'User::model()->getlevel(Yii::app()->user->id)==12',
				),				
			),
			'headerHtmlOptions'=>array('style'=>'width:50%'),
		),
	),
)); ?>
